import './shared/services/shared_util.service.dart';

class LocalApp with UIActionMixin {
  LocalApp({
    required this.fileFullName,
    required this.filePath,
    required this.title,
    this.isPinned = false,
  });

  factory LocalApp.fromJson(Map<String, dynamic> json) {
    return LocalApp(
      fileFullName: json['fileFullName'],
      filePath: json['filePath'],
      title: json['title'],
      isPinned:
          SharedUtil.tryToConvert<bool>(json['isPinned'], (p) => p as bool) ??
              false,
    );
  }

  final String fileFullName;
  final String filePath;
  String title;
  bool isPinned;

  Map<String, dynamic> toJson() {
    return {
      'fileFullName': fileFullName,
      'filePath': filePath,
      'title': title,
      'isPinned': isPinned,
    };
  }
}

mixin UIActionMixin {
  bool isHovering = false;
  bool isSelected = false;
}
